﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CONEK911Manager.BUS;
using CONEK911Manager.DTO;

namespace CONEK911Manager
{
    public partial class FormConfig : Form
    {
        List<DistrictDTO> _listDistrict = new List<DistrictDTO>();
        List<ActiveDTO> _listActive = new List<ActiveDTO>(); 
        readonly Dictionary<string, string> _textboxWithText = new Dictionary<string, string>();
        public FormConfig()
        {
            InitializeComponent();
            _textboxWithText.Add("txtDistrict", "Quận, huyện");
            _textboxWithText.Add("txtWard", "Phường, xã");
            _textboxWithText.Add("txtActiveName", "Tên hoạt động");
            _textboxWithText.Add("txtPercentF1", "% thế hệ 1");
            _textboxWithText.Add("txtPercentF2", "% thế hệ 2");
            txtDistrict.Focus();
            LoadImage();
            BindData();
            if (cbbDistrict.Items.Count > 0)
            {
                cbbDistrict.SelectedIndex = 0;
            } 
        }

        private void LoadImage()
        {
            btnAddUpdateArea.Image = Base64String.ToImage(Base64String.Add);
            btnDeleteArea.Image = Base64String.ToImage(Base64String.Delete);
            btnAddUpdateActive.Image = Base64String.ToImage(Base64String.Add);
            btnDeleteActive.Image = Base64String.ToImage(Base64String.Delete);
        }

        private void BindData()
        {
            var districtBus = new DistrictBUS();
            _listDistrict = districtBus.GetAllDistrict();
            var activeBus = new ActiveBUS();
            _listActive = activeBus.GetAllActive();
            foreach (var district in _listDistrict)
            {
                if (district.DistrictId != 0)
                {
                    cbbDistrict.Items.Add(district.DistrictName);
                }
            }
            foreach (var active in _listActive)
            {
                if (active.ActiveID != 0)
                {
                    cbbActiveLevel.Items.Add(active.ActiveLevel);
                }
            }
        }

        private void CbbDistrictSelectedIndexChanged(object sender, EventArgs e)
        {
            foreach(var district in _listDistrict)
            {
                
            }
        }
    }
}
